@model SystemInfoModel

@{
    //page title
    ViewBag.PageTitle = T("Admin.System.SystemInfo").Text;
    //active menu item (system name)
    Html.SetActiveMenuItemSystemName("System information");
}

<div class="content-header clearfix">
    <h1 class="pull-left">
        @T("Admin.System.SystemInfo")
    </h1>
    <div class="pull-right">
        &nbsp;
        @await Component.InvokeAsync("AdminWidget", new { widgetZone = AdminWidgetZones.SystemInfoButtons })
    </div>
</div>

<script>
    function toggleLoadedAssemblies() {
        $('#pnlLoadedAssemblies').toggle();
        if ($('#pnlLoadedAssemblies').css('display') == 'none') {
            $('#loadedAssembliesShowHide').text('@T("Admin.Common.Show")');
        }
        else {
            $('#loadedAssembliesShowHide').text('@T("Admin.Common.Hide")');
        }
    }

    function toggleLoadedHeaders() {
        $('#pnlHeaders').toggle();
        if ($('#pnlHeaders').css('display') == 'none') {
            $('#headersShowHide').text('@T("Admin.Common.Show")');
        }
        else {
            $('#headersShowHide').html('@T("Admin.Common.Hide")');
        }
    }

    function toggleRedisDetails() {
        $('#pnlRedisDetails').toggle();
        if ($('#pnlRedisDetails').css('display') == 'none') {
            $('#redisDetailsShowHide').text('@T("Admin.Common.Show")');
        }
        else {
            $('#redisDetailsShowHide').text('@T("Admin.Common.Hide")');
        }
    }
</script>

<div class="content">
    <div class="form-horizontal">
        <div class="panel-group">
            @await Component.InvokeAsync("AdminWidget", new { widgetZone = AdminWidgetZones.SystemInfoTop })
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="NopVersion" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.NopVersion</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="OperatingSystem" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.OperatingSystem</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="AspNetInfo" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.AspNetInfo</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="IsFullTrust" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.IsFullTrust</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="ServerTimeZone" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.ServerTimeZone</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="ServerLocalTime" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.ServerLocalTime.ToString("F")</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="UtcTime" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.UtcTime.ToString("F")</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="CurrentUserTime" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.CurrentUserTime.ToString("F")</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="HttpHost" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.HttpHost</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="Headers" />
                        </div>
                        <div class="col-md-9">
                            <a id="headersShowHide" href="javascript:toggleLoadedHeaders();">@T("Admin.Common.Show")</a>
                            <div id="pnlHeaders" style="display: none; word-break: break-all">
                                <ul>
                                    @foreach (var header in Model.Headers)
                                    {
                                        <li>
                                            <strong>@header.Name</strong>: @header.Value
                                        </li>
                                    }
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="LoadedAssemblies" />
                        </div>
                        <div class="col-md-9">
                            <a id="loadedAssembliesShowHide" href="javascript:toggleLoadedAssemblies();">@T("Admin.Common.Show")</a>
                            <div id="pnlLoadedAssemblies" style="display: none">
                                <ul>
                                    @foreach (var assembly in Model.LoadedAssemblies)
                                    {
                                        <li>
                                            <div>
                                                <strong>@assembly.FullName</strong>
                                                @if (assembly.IsDebug)
                                                {
                                                    <span class="label label-warning">Debug</span>
                                                }
                                                else
                                                {
                                                    <span class="label label-success">Release</span>
                                                }
                                            </div>
                                            @if (!string.IsNullOrEmpty(assembly.Location))
                                            {
                                                <div style="white-space:nowrap;overflow:auto;">
                                                    @assembly.Location
                                                </div>
                                            }
                                            @if (assembly.BuildDate.HasValue)
                                            {
                                                <div>
                                                    @assembly.BuildDate.Value.ToString("s")
                                                </div>
                                            }
                                        </li>
                                    }
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="CurrentStaticCacheManager" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.CurrentStaticCacheManager</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="RedisEnabled" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">
                                @Model.RedisEnabled
                                @if (Model.RedisEnabled)
                                {
                                    <a id="redisDetailsShowHide" href="javascript:toggleRedisDetails();">@T("Admin.Common.Show")</a>
                                }
                            </div>
                            <div id="pnlRedisDetails" style="display: none">
                                <ul>
                                    <li>
                                        <div>
                                            <strong> @T("Admin.System.SystemInfo.UseRedisToStoreDataProtectionKeys")</strong>
                                        </div>
                                        <div style="white-space: nowrap; overflow: auto;">
                                            @Model.UseRedisToStoreDataProtectionKeys
                                        </div>
                                    </li>
                                    <li>
                                        <div>
                                            <strong>@T("Admin.System.SystemInfo.UseRedisForCaching")</strong>
                                        </div>
                                        <div style="white-space: nowrap; overflow: auto;">
                                            @Model.UseRedisForCaching
                                        </div>
                                    </li>
                                    <li>
                                        <div>
                                            <strong>@T("Admin.System.SystemInfo.UseRedisToStorePluginsInfo")</strong>
                                        </div>
                                        <div style="white-space: nowrap; overflow: auto;">
                                            @Model.UseRedisToStorePluginsInfo
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            <nop-label asp-for="AzureBlobStorageEnabled" />
                        </div>
                        <div class="col-md-9">
                            <div class="form-text-row">@Model.AzureBlobStorageEnabled</div>
                        </div>
                    </div>
                </div>           
            </div>
            @await Component.InvokeAsync("AdminWidget", new { widgetZone = AdminWidgetZones.SystemInfoBottom })
        </div>
    </div>
</div>